package topin.facecat.FaceCat.UI

import facecat.topin.btn.FCButton
import facecat.topin.core.FCColor
import facecat.topin.core.FCFont
import facecat.topin.core.FCPaint
import facecat.topin.core.FCRect
import topin.facecat.FaceCat.UI.MyChart
import topin.facecat.FaceCat.UI.MyColor

class CycleButton : FCButton() {
    var m_cycle = 0
    var m_chart: MyChart? = null

    init {
        font = FCFont("Default", 14f)
    }

    override fun getPaintingTextColor(): Long {
        return if (MyColor.m_style == 0) {
            FCColor.rgb(200, 200, 200)
        } else super.getPaintingTextColor()
    }

    override fun onPaintForeground(paint: FCPaint, clipRect: FCRect) {
        val width = width
        val height = height
        val cWidth = clipRect.right - clipRect.left
        paint.drawLine(FCColor.Border, 1f, 0, width - 1, 5, width - 1, height - 5)
        if (m_chart != null && m_chart!!.m_cycle != 0 && m_chart!!.m_cycle == m_cycle) {
            paint.fillRect(FCColor.Pushed, 1, 1, width - 1, height - 1)
            paint.drawRect(MyColor.USERCOLOR109, 1f, 0, 1, 1, width - 1, height - 1)
        }
        super.onPaintForeground(paint, clipRect)
    }
}



